const p1 = new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve('p1 success')
  }, 1000)
})
const p2 = new Promise((resolve, reject) => {
  setTimeout(() => {
    // resolve('p2 success')
    reject('p2 fail')
  }, 2000)
})
const p3 = new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve('p3 success')
  }, 3000)
})

setTimeout(() => {
  Promise.all([p1, p2, p3])
    .then((res) => {
      console.log(res)
    })
    .catch((err) => {
      console.log(err)
    })
}, 4000)
